package cn.tedu;

import java.sql.*;

public class Demo03 {
    public static void main(String[] args) throws SQLException {
        Connection coon = DriverManager.getConnection("jdbc:mysql://localhost:3306/empdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai",
                "root","root");
        Statement s = coon.createStatement();
        ResultSet rs = s.executeQuery("select *from hero");
        while(rs.next()){
            String name = rs.getString("name");
            int money = rs.getInt("money");
            System.out.println(name+":"+money);
        }
        coon.close();
    }
}
